﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Admin_Lop_Xoa : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string action = Request.Params["action"].ToString();
        if (action == "lop")
        {
            int malop = int.Parse(Request.Params["malop"].ToString());
            if (LopDAL.Delete(malop) > 0)
            {
                Session["Mess"] = "Thanh Cong";
                Session["Type"] = "Success";
            }
            else
            {
                Session["Mess"] = "that bai";
                Session["Type"] = "Error";
            }
            Response.Redirect("DanhSachLop.aspx");
        }
        else {
            int malop = int.Parse(Request.Params["malop"].ToString());
            int mahv = int.Parse(Request.Params["mahocvien"].ToString());
            if (HocVien_LopDAL.Delete(mahv,malop) > 0)
            {
                Session["Mess"] = "Thanh Cong";
                Session["Type"] = "Success";
            }
            else
            {
                Session["Mess"] = "that bai";
                Session["Type"] = "Error";
            }
            Response.Redirect("HocVien_Lop.aspx");
        }
    }
}